package ru.susu.algebra.partition.operation;

import ru.susu.algebra.operation.IOperation;
import ru.susu.algebra.partition.Partition;
import ru.susu.algebra.partition.PartitionsFactory;

/**
 * На входе одно целое число, возвращает (m, m-1, ..., 2, 1)
 *
 * @author akargapolov
 * @since: 03.06.2009
 */
public class DeltaMPartitionOperation implements IOperation<Partition>
{

	@Override
	public Partition performOperation(Object... sources)
	{
		Integer source = (Integer) sources[0];
		Integer[] array = new Integer[source];
		for (int index = 0;index < array.length;index++)
			array[index] = index + 1;
		return PartitionsFactory.createPartition(array);
	}

}
